package com.gxuwz.mapper;

import com.gxuwz.model.entity.Classes;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ClassesMapper {
    /* 查询班级信息 */
    @Select("SELECT * FROM sys_classes WHERE classID = #{classID}")
    Classes selectClassByClassID(String classID);
    @Select("SELECT * FROM sys_classes WHERE className = #{className}")
    Classes selectClassByClassName(String className);

    /* 修改班级信息 */
    @Update("UPDATE sys_classes SET className = #{className}, depID = #{depID}, major = #{major}, grade = #{grade} WHERE classID = #{classID}")
    int updateClass(Classes classes);

    /* 添加班级 */
    @Insert("INSERT INTO sys_classes (classID, className, depID, major, grade) VALUES (#{classID}, #{className}, #{depID}, #{major}, #{grade})")
    int insertClass(Classes classes);

    /* 删除班级 */
    @Delete("DELETE FROM sys_classes WHERE classID = #{classID}")
    int deleteClassByClassID(String classID);

    /* 查询所有班级信息  */
    @Select("SELECT * FROM sys_classes")
    List<Classes> getAllClass();
}
